/*     */ package com.qmsk.business.member.memberIntegralDetail.controller;
/*     */ 
/*     */ import com.qmsk.business.member.memberIntegralDetail.dao.MemberIntegralDetailDAO;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.jdbc.connection.DbConnection;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.sql.SQLException;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/memberIntDetal"})
/*     */ public class MemberIntegralDetailController
/*     */ {
/*  32 */   private static final Logger logger = Logger.getLogger(MemberIntegralDetailController.class);
/*     */ 
/*     */   @Autowired
/*     */   private MemberIntegralDetailDAO dao;
/*     */ 
/*     */   @RequestMapping(value={"find/memberId/state/{memberId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListMemberId(HttpServletRequest request, HttpServletResponse response, @PathVariable("memberId") Long memberId)
/*     */   {
/*     */     try
/*     */     {
/*  51 */       GsonEbRst gsonEbRst = this.dao.getGsonOfmemberId(memberId);
/*  52 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/*  54 */       logger.error(e);
/*  55 */       ResponseUtils.setErrorMsgResponse(
/*  56 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @RequestMapping(value={"find/intAmt/memberId/{memberId}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getIntOfMemberId(HttpServletRequest request, HttpServletResponse response, @PathVariable("memberId") Long memberId)
/*     */   {
/*     */     try
/*     */     {
/*  74 */       int nIntAmt = this.dao.getIntAmtMemberId(memberId).intValue();
/*  75 */       ResponseUtils.setResponseResult(nIntAmt, response);
/*     */     } catch (SQLException e) {
/*  77 */       logger.error(e);
/*  78 */       ResponseUtils.setErrorMsgResponse(
/*  79 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"insert"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insert(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*  95 */     String sGsonInData = request.getParameter("data");
/*     */     try {
/*  97 */       int nResult = this.dao.insertJsonOneRow(sGsonInData);
/*  98 */       DbConnection.commit();
/*  99 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 100 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 101 */         response);
/*     */     } catch (Exception e) {
/* 103 */       DbConnection.rollback();
/* 104 */       logger.error(e);
/* 105 */       ResponseUtils.setErrorMsgResponse(
/* 106 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 107 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"del"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void delete(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 123 */     String id = RequestUtils.getStringOfId(request);
/*     */     try {
/* 125 */       String[] strParams = id.split(",");
/* 126 */       int nResult = this.dao.deleteParams(strParams);
/* 127 */       DbConnection.commit();
/* 128 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 129 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 130 */         response);
/*     */     } catch (Exception e) {
/* 132 */       DbConnection.rollback();
/* 133 */       logger.error(e);
/* 134 */       ResponseUtils.setErrorMsgResponse(
/* 135 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 136 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"edit"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void update(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 152 */     String id = request.getParameter("id");
/* 153 */     String sGsonInData = request.getParameter("data");
/*     */     try {
/* 155 */       GsonHeadOneRow g = GsonHeadOneRow.jsonStrToObject(sGsonInData);
/* 156 */       if (g == null) {
/* 157 */         ResponseUtils.setErrorMsgResponse(
/* 158 */           RequestUtils.getReadJsonDataErrorMessage(request), 
/* 159 */           response);
/*     */       } else {
/* 161 */         int nResult = this.dao.updateJsonOneRow(g, id);
/* 162 */         ResponseUtils.setSqlResultResponse(nResult, 
/* 163 */           RequestUtils.getSqlUpdateErrorMessage(sGsonInData, request), 
/* 164 */           response);
/*     */       }
/* 166 */       DbConnection.commit();
/*     */     } catch (Exception e) {
/* 168 */       DbConnection.rollback();
/* 169 */       logger.error(e);
/* 170 */       ResponseUtils.setErrorMsgResponse(
/* 171 */         RequestUtils.getSqlUpdateErrorMessage(sGsonInData, request) + ":" + 
/* 172 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.member.memberIntegralDetail.controller.MemberIntegralDetailController
 * JD-Core Version:    0.5.3
 */